package com.micro.school.order.controller;

import java.util.List;

import com.micro.school.common.core.utils.poi.ExcelUtil;
import com.micro.school.common.core.web.controller.BaseController;
import com.micro.school.common.core.web.domain.AjaxResult;
import com.micro.school.common.core.web.page.TableDataInfo;
import com.micro.school.common.log.annotation.Log;
import com.micro.school.common.log.enums.BusinessType;
import com.micro.school.system.api.domain.vo.PayStudentFeePaymentDetailVos;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.micro.school.order.domain.PayStudentFeePaymentDetail;
import com.micro.school.order.service.IPayStudentFeePaymentDetailService;

/**
 * 支付单明细Controller
 * 
 * @author lyb
 * @date 2025-08-19
 */
@RestController
@RequestMapping("/pay/payStudentFeePaymentDetail")
public class PayStudentFeePaymentDetailController extends BaseController
{
    @Autowired
    private IPayStudentFeePaymentDetailService payStudentFeePaymentDetailService;

    /**
     * 查询支付单明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PayStudentFeePaymentDetail payStudentFeePaymentDetail)
    {
        startPage();
        List<PayStudentFeePaymentDetail> list = payStudentFeePaymentDetailService.selectPayStudentFeePaymentDetailList(payStudentFeePaymentDetail);
        return getDataTable(list);
    }

    /**
     * 导出支付单明细列表
     */
    @Log(title = "支付单明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PayStudentFeePaymentDetail payStudentFeePaymentDetail)
    {
        List<PayStudentFeePaymentDetail> list = payStudentFeePaymentDetailService.selectPayStudentFeePaymentDetailList(payStudentFeePaymentDetail);
        ExcelUtil<PayStudentFeePaymentDetail> util = new ExcelUtil<PayStudentFeePaymentDetail>(PayStudentFeePaymentDetail.class);
        util.exportExcel(response, list, "支付单明细数据");
    }

    /**
     * 获取支付单明细详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(payStudentFeePaymentDetailService.selectPayStudentFeePaymentDetailById(id));
    }

    /**
     * 新增支付单明细
     */
    @Log(title = "支付单明细", businessType = BusinessType.INSERT)
    @PostMapping("/insertPayStudentFeePaymentDetailVos")
    public AjaxResult insertPayStudentFeePaymentDetailVos(@RequestBody PayStudentFeePaymentDetailVos payStudentFeePaymentDetail)
    {
        return toAjax(payStudentFeePaymentDetailService.insertPayStudentFeePaymentDetailVos(payStudentFeePaymentDetail));
    }



    /**
     * 新增支付单明细
     */
    @Log(title = "支付单明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PayStudentFeePaymentDetail payStudentFeePaymentDetail)
    {
        return toAjax(payStudentFeePaymentDetailService.insertPayStudentFeePaymentDetail(payStudentFeePaymentDetail));
    }

    /**
     * 修改支付单明细
     */
    @Log(title = "支付单明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PayStudentFeePaymentDetail payStudentFeePaymentDetail)
    {
        return toAjax(payStudentFeePaymentDetailService.updatePayStudentFeePaymentDetail(payStudentFeePaymentDetail));
    }

    /**
     * 删除支付单明细
     */
    @Log(title = "支付单明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(payStudentFeePaymentDetailService.deletePayStudentFeePaymentDetailByIds(ids));
    }
}
